﻿#ifndef JCONCURRENT_GLOBAL_H
#define JCONCURRENT_GLOBAL_H

// - JCONCURRENT_VERSION is (major << 16) + (minor << 8) + patch.

#define JCONCURRENT_VERSION       0x010000
#define JCONCURRENT_VERSION_STR   "1.0.0"

#ifdef _MSC_VER

#if defined(JCONCURRENT_MAKE)
#define JCONCURRENT_EXPORT __declspec(dllexport)
#else
#define JCONCURRENT_EXPORT __declspec(dllimport)

#endif  // defined(JCONCURRENT_MAKE)

#endif  // _MSC_VER

#ifndef JCONCURRENT_EXPORT
#define JCONCURRENT_EXPORT
#endif

#if defined(_MSC_VER)

#ifndef JCONCURRENT_MAKE

#if defined(_DEBUG) || defined(DEBUG)
#pragma comment(lib, "jconcurrentd.lib")
#else
#pragma comment(lib, "jconcurrent.lib")
#endif  // defined(_DEBUG) || defined(DEBUG)

#endif  // !JCONCURRENT_MAKE

#endif

#include <utility>
#include "jthreadpool_global.h"

//
#ifndef J_DECLARE_OBSERVER
#define J_DECLARE_OBSERVER(_class_) \
    public: \
        void setObserver(_class_ ## Observer *add, _class_ ## Observer *remove = 0); \
    private:
#endif

// - class JConcurrentCore -

class JConcurrentCorePrivate;

class JCONCURRENT_EXPORT JConcurrentCore
{
public:
    static JConcurrentCore *instance();
    static void releaseInstance();

    int run();
    int exec();

private:
    JConcurrentCore();
    ~JConcurrentCore();

private:
    JConcurrentCorePrivate *d;
};

#endif // JCONCURRENT_GLOBAL_H
